import React, { lazy } from 'react';  

  
// 定义路由接口  
export interface RouteConfig {  
  path: string;  
  element?: React.ReactElement | null;  
  children?: RouteConfig[];  
  title?: string;  
  // 您可以添加其他属性，如 meta、exact 等  
}  
  
// 懒加载组件  
const Home = lazy(() => import('../pages/Home'));  
const Lntelligent = lazy(() => import('../pages/Child/Lntelligent'));  
const Obtain = lazy(() => import('../pages/Child/Obtain'));  
const Security = lazy(() => import('../pages/Child/Security'));  
const Maintenance = lazy(() => import('../pages/Child/Maintenance'));  
  
// 路由配置  
const nroutes: RouteConfig[] = [  
  {  
    path: '/',  
    element: <Home />, // 或者您可以使用重定向到 '/home'  
  },  
  {  
    path: '/home',  
    element: (  
      <React.Suspense fallback={<div>Loading...</div>}>  
        <Home />  
      </React.Suspense>  
    ),  
    title: '首页',  
    children: [  
      {  
        path: 'Lntelligent',  
        element: (  
          <React.Suspense fallback={<div>Loading...</div>}>  
            <Lntelligent />  
          </React.Suspense>  
        ),  
        title: '智能检测',  
      },  
       {  
        path: 'Obtain',  
        element: (  
          <React.Suspense fallback={<div>Loading...</div>}>  
            <Obtain />  
          </React.Suspense>  
        ),  
        title: '智能检测',  
      }, 
       {  
        path: 'Security',  
        element: (  
          <React.Suspense fallback={<div>Loading...</div>}>  
            <Security />  
          </React.Suspense>  
        ),  
        title: '智能检测',  
      }, 
       {  
        path: 'Maintenance',  
        element: (  
          <React.Suspense fallback={<div>Loading...</div>}>  
            <Maintenance />  
          </React.Suspense>  
        ),  
        title: '智能检测',  
      },   
    ],  
  },  
  // 注意：在实际应用中，您可能需要在父组件（如 Home）中处理子路由的渲染  
];

export default nroutes